﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaInfrastructure;


namespace GWModflow.FileLayers.MT3DMS
{
    public class GCGSolverPack:Package
    {
        public GCGSolverPack()
        {
            this._fileType = FileType.GCG;
            this.Fname = "mt3dms.gcg";
        }
        private int _MXITER;//外部迭代的最大数;只有当模拟中包含一个非线性吸附等温线时MXITER应被设为一个大于1的整数.
        /// <summary>
        /// 外部迭代的最大数;只有当模拟中包含一个非线性吸附等温线时MXITER应被设为一个大于1的整数.
        /// </summary>
        public int MXITER
        {
            get { return _MXITER; }
            set { _MXITER = value; }
        }
        private int _ITER1;//内部迭代的最大数;对于大多数问题一个介于30到50之间的数值是适宜的
        /// <summary>
        /// 内部迭代的最大数;对于大多数问题一个介于30到50之间的数值是适宜的
        /// </summary>
        public int ITER1
        {
            get { return _ITER1; }
            set { _ITER1 = value; }
        }

        private int _ISOLVE;
        /// <summary>
        /// 是Lanczoz/ORTHOMIN加速方案适用的先决条件种类
        ///  =1,Jacobi
        ///   =2,SSOR
        ///    =3,Modified Incomplete Cholesky(MIC)(MIC一般汇聚的更快,但它明显需要更大的内存)
        /// </summary>
        public int ISOLVE
        {
            get { return _ISOLVE; }
            set { _ISOLVE = value; }
        }

        private int _NCRS;
        /// <summary>
        /// 标示对扩散张量交叉项的处理
        /// =0,将所有扩散交叉项向右放在一起(相近但高效)
        /// =1,包括完整的扩散张量(需要大量内存)
        /// </summary>
        public int NCRS
        {
            get { return _NCRS; }
            set { _NCRS = value; }
        }

        private double _ACCL;
        /// <summary>
        /// 是SSOR选项的松弛系数;一般一个1.0的数值是适宜的
        /// </summary>
        public double ACCL
        {
            get { return _ACCL; }
            set { _ACCL = value; }
        }

        private double _CCLOSE;
        /// <summary>
        /// 是相对浓度的汇聚标准;一般一个介于10-4和10-6之间的实数是适宜的.
        /// </summary>
        public double CCLOSE
        {
            get { return _CCLOSE; }
            set { _CCLOSE = value; }
        }

        private int _IPRGCG;
        /// <summary>
        /// 是列印每个迭代的最大浓度变化的间隔时间.在每个应力期结束时列印,将IPRGCG默认设置为零.
        /// </summary>
        public int IPRGCG
        {
            get { return _IPRGCG; }
            set { _IPRGCG = value; }
        }
        public override void WriteFile(string path)
        {
            string content = string.Format("{0,10}", GetNumberLengthFormat(this.MXITER,10))  + string.Format("{0,10}",GetNumberLengthFormat( this.ITER1,10)) + string.Format("{0,10}",GetNumberLengthFormat( this.ISOLVE,10)) +
                 string.Format("{0,10}", GetNumberLengthFormat(this.NCRS,10)) + "      MXITER,ITER1,ISOLVE,NCRS" + "\r\n";
            content += string.Format("{0,10}",GetNumberLengthFormat( this.ACCL,10))  + string.Format("{0,10}",GetNumberLengthFormat( this.CCLOSE,10))  + string.Format("{0,10}",GetNumberLengthFormat( this.IPRGCG,10)) + "                 ACCL,CCLOSE,IPRGCG" + "\r\n";
           
            
            
            string fname = path + this.Fname;
           FileHelper.WriteFile(fname, content);
        }
    }
}
